/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Scanner;

/**
 * <p>Project: javase2203 - Switch3
 * <p>Powered by webrx On 2022-07-13 16:59:44
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Switch3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年月:");
        int year = sc.nextInt();
        int month = sc.nextInt();
        int days = 30;
        switch (month) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                days = 31;
                break;
            case 2:
                days = year % 400 == 0 || year % 4 == 0 && year % 100 != 0 ? 29 : 28;
                break;
            default:
                days = 30;
                break;
        }
        System.out.printf("%d年%d月有%d天%n",year,month,days);

    }
}
